#!/usr/bin/env bash

set -euxo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
ROOT_DIR=$( cd -- "$SCRIPT_DIR/.." &> /dev/null && pwd )
OHPB_DIR=$( cd -- "$ROOT_DIR/../openharmony_prebuilts" &> /dev/null && pwd )
# NAME="$( basename -- "$ROOT_DIR" )"
NAME=ohos
WS_DIR=/workspace

DOCKER_IMAGE="${DOCKER_IMAGE:-ohos_ohpb}"
PREBUILTS_VOLUME=ohos_prebuilts

docker run --rm -it \
    --mount "type=bind,src=$ROOT_DIR,dst=$WS_DIR/$NAME" \
    --mount "type=volume,src=$PREBUILTS_VOLUME,dst=$WS_DIR/$NAME/prebuilts" \
    "$DOCKER_IMAGE"
